export const Config = {
    appIcon: {
      accept: ['image/jpg', 'image/png', 'image/jpeg'],
      maxCount: 1,
      formatTitle: '',
      limit: (e) => {
        const file = e ;
        // const maxFileSize = 100 * 1024; // 100kb
        const maxFileSize = 1024 * 1024 * 10 ; // 10m
        // 1 * 1024 * 1024 * 1024; // 1G
        const fileSize = file.size || 0;
        const fileType = file.type || '';
        const img = new Image();
        img.src = window.URL.createObjectURL(file);
        return new Promise((resolve) => {
          img.onload = () => {
            if (fileSize > maxFileSize) {
              resolve(`图标大小不能超过100KB`);
            } else if (!Config.appIcon.accept.includes(fileType)) {
              resolve(`图标格式不支持`);
            } else if (img.width < 192 || img.height < 192) {
              resolve(`图标尺寸不能小于192*192PX`);
            }
            // else if (img?.height <= img?.width) {
            //     resolve(`上传图片仅支持竖图`);
            //   } 
              else if(fileSize > maxFileSize) {
                resolve(`上传图片不能超过10张`);
              } else {
              resolve('');
            }
          };
          img.onerror = () => {
            resolve(`读取失败`);
          };
        });
      },
    },

 
   
  };
  